package com.evaluationsystem.system.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.evaluationsystem.system.serivce.PositionAndTeamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@RequestMapping("positionAndTeam")
@Api("职位 和 班组录入接口，2020-4-14，gdy")
public class PositionAndTeamController {

    @Autowired
    PositionAndTeamService service;

    @GetMapping("")
    @ApiOperation(value = "职位 和 班组录入页面 跳转接口",notes = "2020-4-14，gdy")
    public String positionAndTeamHtml(){
        return "system/positionAndTeam/positionAndTeam";
    }

    @PostMapping("getPositionTableList")
    @ResponseBody
    @ApiOperation(value = "职位 table 数据加载 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> getPositionTableList(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.getPositionTableList(param);
        return res;
    }

    @PostMapping("positionadd")
    @ResponseBody
    @ApiOperation(value = "职位 新增 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> positionAdd(@RequestBody Map<String,Object> param){
        System.out.println(param);
        Map<String,Object> res = service.positionAdd(param);
        return res;
    }

    @PostMapping("startAndForbid")
    @ResponseBody
    @ApiOperation(value = "职位 禁用/启用 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> startAndForbid(@RequestBody Map<String,Object> param){
        System.out.println(param);
        Map<String,Object> res = service.startAndForbid(param);
        return res;
    }

    @GetMapping("positionUpdataHtml/{vpositionid}/{vpositionname}")
    @ApiOperation(value = "职位 修改页面跳转 接口",notes = "2020-4-14，gdy")
    public String positionUpdataHtml(@PathVariable("vpositionid") String vpositionid,@PathVariable("vpositionname") String vpositionname, Map<Object,Object> map){
        map.put("vpositionid",vpositionid);
        map.put("vpositionname",vpositionname);
        return "system/positionAndTeam/positionUpdata";
    }


    @PostMapping("updataPositionVpositionname")
    @ResponseBody
    @ApiOperation(value = "职位 修改页保存 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> UpdataPositionVpositionname(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.updataPositionVpositionname(param);
        return res;
    }


    @PostMapping("getTeamTableList")
    @ResponseBody
    @ApiOperation(value = "班组 table 数据加载 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> getTeamTableList(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.getTeamTableList(param);
        return res;
    }

    @GetMapping("getTeamAddHtml")
    @ApiOperation(value = "班组 新增 页面跳转 接口",notes = "2020-4-14，gdy")
    public String getTeamAddHtml(){
        return "system/positionAndTeam/teamAdd";
    }

    @PostMapping("radioAndAelectData")
    @ResponseBody
    @ApiOperation(value = "班组 选择条件 加载 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> radioAndAelectData(){
        Map<String,Object> res = service.radioAndAelectData();
        return res;
    }

    @PostMapping("teamAdd")
    @ResponseBody
    @ApiOperation(value = "班组 新增页面 保存 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> teamAdd(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.teamAdd(param);
        return res;
    }

    @GetMapping("teamUpdataHtml")
    @ApiOperation(value = "班组 修改页面跳转 接口",notes = "2020-4-14，gdy")
    public String teamUpdataHtml(@RequestParam Map<Object,Object> param,Map<Object,Object> map){
        map.put("team",param);
        return "system/positionAndTeam/teamUpdata";
    }

    @PostMapping("teamStartAndForbid")
    @ResponseBody
    @ApiOperation(value = "班组 禁用/启用 修改 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> teamStartAndForbid(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.teamStartAndForbid(param);
        return res;
    }

    @PostMapping("teamUpdata")
    @ResponseBody
    @ApiOperation(value = "班组 修改页保存 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> teamUpdata(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.teamUpdata(param);
        return res;
    }
}
